<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>项目详情</title>
    <link rel="stylesheet" th:href="@{/layui/dist/css/layui.css}"  media="all">
</head>
<body class="layui-view-body">
<div class="layui-content">
    <div class="layui-row">
        <div class="layui-col-md11">
            <form class="layui-form" lay-filter="formTestFilter2121" style="margin-top: 50px;">
                <div class="layui-form-item">
                    <label class="layui-form-label">项目编号：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="itemNo" class="layui-input" readonly="readonly" th:value="${items.getItemNo()}" >
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">项目名称：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="itemName" class="layui-input" readonly="readonly" th:value="${items.getItemName()}" >
                    </div>
                    <label class="layui-form-label">项目类型：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="itemType"  class="layui-input" readonly="readonly"
                               th:value="${items.getItemType()} == '1' ? 'web网站'
                                : (${items.getItemType()} == '2' ? 'App开发'
                                : (${items.getItemType()} == '3' ? '微信公众号'
                                : (${items.getItemType()} == '4' ? '小程序'
                                : (${items.getItemType()} == '5' ? 'HTML应用' : '其他项目')
                                )
                                )
                                )
						">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">发布者编号：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="userNo"  class="layui-input" readonly="readonly" th:value="${items.getCodeUsers()[0].getUserNo()}">
                    </div>
                    <label class="layui-form-label">发布者姓名：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="username"  class="layui-input" readonly="readonly" th:value="${items.getCodeUsers()[0].getUsername()}">
                    </div>
                    <label class="layui-form-label">发布者Email：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="email" class="layui-input" readonly="readonly" th:value="${items.getCodeUsers()[0].getEmail()}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">项目状态：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="itemDid" class="layui-input" readonly="readonly"
                               th:value="${items.getItemDid()} == '1' ? '正在招募中'
							     : (${items.getItemDid()} == '2' ? '正在进行中' : '已完成'
							     )
						">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">项目标价：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="money" class="layui-input" readonly="readonly" th:value="${items.getMoney()}">
                    </div>
                    <label class="layui-form-label">项目周期：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="day" class="layui-input" readonly="readonly" th:value="${items.getDay()}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">发布者类型：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="developerType" class="layui-input" readonly="readonly"
                               th:value="${items.getCodeUsers()[0].getDeveloperType()} == '1' ? '个人开发' : '团队开发'
						">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn layui-btn" type="button" th:onclick="'Pass(' + ${items.itemNo} + ')' ">通过</button>
                        <button class="layui-btn layui-btn layui-btn-danger" type="button" th:onclick="'noPass(' + ${items.itemNo}+ ')' ">不通过</button>
                        <button type="button" class="layui-btn layui-btn-normal" onclick="exit()" style="width: 80px;">返回</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script th:src="@{/layui/dist/layui.all.js}" charset="utf-8"></script>
<script th:src="@{/js/jquery.min.js}" charset="utf-8"></script>
<script type="text/javascript">
    function exit() {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index); //再执行关闭
    }

    function Pass(itemNo) {

        $.ajax({
            type:"get",
            dataType:"text",
            url:"/code/itemsPass?itemNo=" + itemNo,
            success: function (data) {
                if(data == "success"){
                    window.parent.location.reload(); //刷新父页面
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
                }
            }
        });


    }

    function noPass(itemNo) {

        $.ajax({
            type:"get",
            url:"/code/itemsNoPass?itemNo=" + itemNo,
            datatype:"text",
            success:function (data) {
                if (data == "success") {
                    window.parent.location.reload(); //刷新父页面
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
                }
            }
        });

    }

</script>
</body>
</html>
